/**
    The Player class extends the Sprite class to add states
    (STATE_NORMAL or STATE_JUMPING) and gravity.
*/
public class Enemy extends Sprite {

    public static final int STATE_NORMAL = 0;
    public static final int STATE_JUMPING = 1;

    public static final float SPEED = .3f;		//Default Speed = .3f = dx
    public static final float GRAVITY = .002f; // Default Gravity = .002f = dy

    private int state;
    
    public Enemy(Animation anim) {
        super(anim);
        state = STATE_NORMAL;
    }


    /**
        Gets the state of the Player (either STATE_NORMAL or
        STATE_JUMPING);
    */
    public int getState() {
        return state;
    }


    /**
        Sets the state of the Player (either STATE_NORMAL or
        STATE_JUMPING);
    */
    public void setState(int state) {
        this.state = state;
    }

    /**
        Causes the Player to jump
    */
    public void jump() {
        setVelocityY(-1f);
        state = STATE_JUMPING;
    }
    
    /**
    Causes the Player to drop to the Floor
    */
    public void dropToFloor() {
    DMastaGX.MasterGX.setFloorY(1500);
    setVelocityY(.6f);
    state = STATE_NORMAL;
   // DMastaGX.MasterGX.CollisionDetector.UpdateDMastaGXCollisionRectangle(DMastaGX.MasterGX);
}


    /**
        Updates the player's position and animation. Also, sets the
        Player's state to NORMAL if a jumping Player landed on
        the floor.
    */
    public void UpdatePlayer(long elapsedTime) {
        // set vertical velocity (gravity effect)
        if (getState() == STATE_JUMPING) {
            setVelocityY(getVelocityY() + GRAVITY * elapsedTime);
        }

        // move player
        super.UpdateSprite(elapsedTime);
             

        }
    
    
}

